// import {resp} from '@/utils/response';
export class DocInfo {
  constructor() {
    this.createTime = '';
    this.createUserName = '';
    this.creator = '';
    this.editTime = '';
    this.editUserName = '';
    this.owner = '';
    this.ownerUserName = '';
    this.title = '';
    this.url = '';
    this.token = '';
  }
}

export default {
  state: {
    docInfos: new Map(),
  },
  getters: {
    getDocInfos(state) {
      return state.docInfos;
    },
    getDocInfoByToken: (state) => (token) => {
      return state.docInfos.get(token);
    },
  },
  mutations: {
    insertDocInfo(state, payload) {
      state.docInfos = payload;
    },
    removeDocInfo(state, docToken) {
      state.docInfos.delete(docToken);
    },
    updateDocInfo(state, payload) {
      state.docInfos.set(payload.token, payload);
    },
  },
};
